package com.flight.trans.adapter;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.flight.trans.R;
import com.flight.trans.bean.LeavePortGroupBoardDetailBean.GroupBoardDetailData.DetailsOrderData;
import com.flight.trans.global.Constant;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;

import java.util.List;

/**
 * 出港组板排序
 */
public class LeavePortGroupBoardSortAdapter extends BaseRecyclerAdapter<DetailsOrderData> {

    public LeavePortGroupBoardSortAdapter(Context mContext, List<DetailsOrderData> mList) {
        super(mContext, mList);
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_leave_port_group_board_sort;
    }

    @Override
    protected void bindData(BaseViewHolder holder, DetailsOrderData data, int position) {
        LinearLayout mLlContainerItem = holder.findViewById(R.id.mLlContainerItem);
        TextView mTvSort = holder.findViewById(R.id.mTvSort);//序号
        TextView mTvContainerNo = holder.findViewById(R.id.mTvContainerNo);//容器号
        TextView mTvCount = holder.findViewById(R.id.mTvCount);//件数
        TextView mTvWeight = holder.findViewById(R.id.mTvWeight);//重量
        TextView mTvDeep = holder.findViewById(R.id.mTvDeep);//目的站

        if(data.getPosition() != Constant.SortNullPosition){
            mTvSort.setVisibility(View.VISIBLE);
            mTvSort.setText(String.valueOf(data.getPosition()));
        }else {
            mTvSort.setVisibility(View.INVISIBLE);
            mTvSort.setText("");
        }

        mTvContainerNo.setText(data.getTransportCode());
        mTvCount.setText(String.valueOf(data.getNumber()));
        mTvWeight.setText(String.valueOf(data.getWeight()));
        mTvDeep.setText(String.valueOf(data.getDeap()));

        setOnItemClickListener(mLlContainerItem , position);
    }
}
